package com.itheima.test1;

//回合制格斗游戏
public class roleTest {
    public static void main(String[] args) {
        //创建第一个角色
        role r1 = new role("乔峰",100);
        //第二个
        role r2 = new role("达摩",100);

        //开始格斗，回合制游戏
        while(true){
            //r1攻击r2
            r1.attack(r2);
            //判断r2剩余血量
            if(r2.getBlood() == 0){
                System.out.println(r1.getName()+"KO了"+r2.getName());
                break;
            }

            //r2开始攻击r1
            r2.attack(r1);
            //判断r1剩余血量
            if(r1.getBlood() == 0){
                System.out.println(r2.getName()+"KO了"+r1.getName());
                break;
            }
        }
    }
}
